﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VirtualDrive
{
    public static class CheckText
    {
        public static bool _AddArrayFile(List<string> Items, List<string> Files)
        {
            bool _Add = true;

            Task WaitTilF = new Task(() =>
            {
                foreach (string item in Items)
                {
                    foreach (string file in Files)
                    {
                        if (item.ToLowerInvariant().Contains(file.ToLowerInvariant()))
                        {
                            _Add = false;
                        }
                    }
                }
            }); WaitTilF.Start(); WaitTilF.Wait();


            return _Add;

        }

        public static bool _AddFile(List<string> Items,string Files)
        {
            bool _Add = true;

            Task WaitTilF = new Task(() =>
            {
                foreach (string item in Items)
                {
                    if (item.ToLowerInvariant().Contains(Files.ToLowerInvariant()))
                    {
                        _Add = false;
                    }

                }
                
            }); WaitTilF.Start(); WaitTilF.Wait();


            return _Add;

        }
      public  static bool ArrayisEmpty(string[] Array)
        {
            bool ArrayisEmpty = true;
            try
            {
                if (Array[0] != null)
                {
                    ArrayisEmpty = false;
                }
            }
            catch (NullReferenceException)
            {

                ArrayisEmpty = true;

            }
            return ArrayisEmpty;
        }


      public static bool StringisEmpty(object Text)
      {
          bool ArrayisEmpty = true;
          try
          {
              if (!string.IsNullOrEmpty(Convert.ToString (Text) ))
              {
                  ArrayisEmpty = false;
              }
          }
          catch (NullReferenceException)
          {

              ArrayisEmpty = true;

          }
          return ArrayisEmpty;
      }
    }
}
